{include file='common/head'}
<body>
<div class="x-body">
<form class="layui-form" method="post" action="{:url('index/reals/bncset')}">
        <div class="layui-form-item">
            <label for="desc" class="layui-form-label">
                <span class="x-red">*</span>工作时间
            </label>
            <div class="layui-input-block">
                <textarea placeholder="" id="desc" required="" lay-verify="required"  name="workdate" class="layui-textarea">{$res.workdate}</textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label for="desc" class="layui-form-label">
                <span class="x-red">*</span>联系方式
            </label>
            <div class="layui-input-block">
                <textarea placeholder=""  required="" lay-verify="required" id="desc" name="way" class="layui-textarea">{$res.way}</textarea>
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label for="desc" class="layui-form-label">
                 <span class="x-red">*</span>客服电话
            </label>
            <div class="layui-input-block">
                <input type="number "   placeholder="" required="" lay-verify="phone"name="tel" value="{$res.tel}" autocomplete="off" class="layui-input"/> 

            </div>
        </div>
        <div class="layui-form-item">
            <label for="L_repass" class="layui-form-label">
            </label>
            <button  class="layui-btn" lay-filter="bncset" lay-submit="">
                发布
            </button>
        </div>
    </form>
</div>
<script>
    layui.use(['form','layer'], function(){
        $ = layui.jquery;
        var form = layui.form
            ,layer = layui.layer;

        //自定义验证规则
        //监听提交
        form.on('submit(bncset)', function(data){
            console.log(data);
            //var url="";
            $.ajax({
                type: "post",
                async:false,
                url: "{:url('index/reals/bncset')}",
                data: data.field,
                success:function(msg){
					if(msg.code==1){
						layer.msg(msg.msg,{icon:1,time:2000});
						//发异步，把数据提交给php
						layer.alert("增加成功", {icon: 6},function () {
							// 获得frame索引
							var index = parent.layer.getFrameIndex(window.name);
							//关闭当前frame
							parent.layer.close(index);
						});
                       	window.parent.location.reload();//刷新父级窗口
						
					}else{
                      	window.parent.location.reload();//刷新父级窗口
					}
				}
        })
            return false;
        });


    });
</script>

</body>

</html>